package com.wkhyapp.lm.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.umeng.commonsdk.debug.I;
import com.wkhyapp.lm.R;
import com.wkhyapp.lm.adapter.base.HolderEntity;
import com.wkhyapp.lm.adapter.base.MirAdapter;
import com.wkhyapp.lm.http.vo.CCategory;
import com.wkhyapp.lm.http.vo.CategoryItem;
import com.wkhyapp.lm.utils.ImageLoadUtil;

import java.util.List;

/**
 * Created by fang on 2022/1/17.
 */

public class CCategoryItemAdapter extends MirAdapter<CategoryItem> {

    public CCategoryItemAdapter.callBack mCallBack;


    public CCategoryItemAdapter(Context context, List<CategoryItem> mDatas, int itemLayoutId) {
        super(context, mDatas, itemLayoutId);
    }

    @Override
    public void convert(HolderEntity helper, final CategoryItem item) {
        helper.setText(R.id.name_tv,item.getName());
        ImageView img_iv = helper.getView(R.id.img_iv);
        ImageLoadUtil.setRoundImage_Normal(mContext,item.getImgUrl(),8,img_iv);
        img_iv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mCallBack.jump(item.getSkey()+"",item.getScategoryId());
            }
        });
    }

    public void  setCallBack(CCategoryItemAdapter.callBack callBack){
        this.mCallBack = callBack;
    }



    public interface  callBack{
        void jump(String item, int categryId);

    }
}
